package com.sangu.dianxiu.adapter;

import android.content.Context;
import android.net.Uri;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.sangu.dianxiu.R;
import com.sangu.dianxiu.bean.repairtype.RepairTypeEntity;

import java.util.List;

/**
 * 维修类型adapter,继承自AppBaseAdapter
 * Created by sg2 on 2016/1/5.
 */
public class RepairTypeGvAdapter extends AppBaseAdapter{
    public RepairTypeGvAdapter(List list, Context context) {
        super(list, context);
    }


    @Override
    public ViewHolder getViewHolder(int position, View convertView, ViewGroup parent) {
        RepairTypeEntity.CatesEntity entity= (RepairTypeEntity.CatesEntity) list.get(position);
        ViewHolder vh=ViewHolder.get(context,convertView,parent, R.layout.item_repair_type_gridview);
        SimpleDraweeView ivIcon= (SimpleDraweeView) vh.findViewById(R.id.iv_item_repair_type_icon);
        TextView tvName= (TextView) vh.findViewById(R.id.tv_item_repair_type_name);
        ivIcon.setImageURI(Uri.parse(entity.getImgUrl()));      //使用Facebook的fresco图片加载框架，相应的xml文件中的图片控件也应该为SimpleDraweeView
        tvName.setText(entity.getName());
        return vh;          //此为返回的每项的视图
    }
}
